package hsl.study.controller;


import hsl.study.utils.ExpressTools;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import hsl.study.utils.DateTimeTools;

/**
 * @Description:
 * @Author: hsl
 * @CreateDate: 2025/8/4 11:53
 * @Version: 1.0
 */


@RestController
@RequestMapping("/express")
public class ExpressController {
    @Resource
    private ChatClient chatClient;

    /**
     * http://localhost:7013/express/chat?question=查询快递信息
     * @param question
     * @return
     */
    @GetMapping("/chat")
    public Flux<String> chat(String question) {
        return chatClient
                .prompt(question)
                .tools(new ExpressTools(), new DateTimeTools())
                .stream()
                .content();
    }
}
